{include file="include/header1.html"}

<!-- topbar starts -->
{include file="include/header2.html"}
<!-- topbar ends -->
        <div class="container-fluid">
        <div class="row-fluid">
<!-- left menu starts -->
{include file="include/leftmenu.html"}
<!-- left menu ends -->
    <div id="content" class="span10">
			<!-- content starts -->
			<div>
				<ul class="breadcrumb">
					<li>
						<a href="#">首页</a> <span class="divider">/</span>
					</li>
					<li>
						<a href="#">菜单</a>
					</li>
				</ul>
			</div>
    <div class="row-fluid sortable">	
				<div class="box span12">
					<div class="box-header well" data-original-title>
						<h2><i class="icon-plus"></i>菜单编辑</h2>
						<div class="box-icon">
							<a href="#" class="btn btn-setting btn-round"><i class="icon-cog"></i></a>
							<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
							<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
						</div>
					</div>
					<!--内容-->
                                        
                                        <div class="box-content">
                                            
                            <!-- #################################################### -->
                            <div class="row-fluid sortable ui-sortable">
				<div class="box span6">
					<div class="box-header well" data-original-title="">
						<h2><i class="icon-tasks"></i>菜单排序</h2>
						<div class="box-icon">
							<a href="#" class="btn btn-setting btn-round"><i class="icon-cog"></i></a>
							<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
							<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
						</div>
					</div>
					<div class="box-content">
                                            <form method="post" action="{$webpaths}?c=menuedit">
                                                <input name="currentmenu" type="hidden" value="{$currentmenuval}" /><div class="breadcrumb">{$currentmenuname}　　<a href="{$webpaths}?c=menuedit&currentmenu={$parentmenu}">../返回上级菜单</a></div>
                            <script type="text/javascript" src="{$webpathskis}js/jquery.1.4.2-min.js"></script>
                            <script type="text/javascript" src="{$webpathskis}js/jquery.dragsort-0.4.min.js"></script>
                            	
                                    <script type="text/javascript">$("ul:first").dragsort();</script>
                                    <ul class="dragsort" id="list1">
                                        
                                        {section name=i loop=$row}
                                        <li><div class="breadcrumb">ID:<span class="myaaa1">{$row[i].id}</span> | <span class="myaaa2"><a href="{$webpaths}?c=menuedit&currentmenu={$row[i].id}">{$row[i].name}</a></span> | <a href="{$webpaths}?c=menuedit&a=editmenu&id={$row[i].id}">编辑</a> | <a class="btn-setting-my" href="#">删除</a></div></li>
                                        {/section}
                                    </ul>

                                    <!-- 排序保存在这里可以检索服务器上的回传 -->
                                    <input name="list1SortOrder" type="hidden" /><input name="olddata" type="hidden" value="{$olddata}" />
                                    <input type="submit" class="btn btn-info" name="clicksort" value="保存排序"/>
                            </form>
                            <script type="text/javascript">
                            $("#list1").dragsort({
                                    dragSelector: "div", 
                                    dragBetween: true, 
                                    dragEnd: saveOrder, 
                                    placeHolderTemplate: "<li class='placeHolder'><div></div></li>",
                                    scrollSpeed: 5
                            });

                            function saveOrder() {
                                    var data = $("span.myaaa1").map(function(){
                                            //return $(this).children().val();
                                            return $(this).text();
                                    }).get();
                                    var str1 = $("input[name=olddata]").val();
                                    $("input[name=list1SortOrder]").val(data.join("|")+"||"+str1);
                            };
                            
                            function enabledselect(){
                                $("select[name=myselect1]").removeAttr("disabled");
                            }
                            
                            function disabledselect(){
                                $("select[name=myselect1]").attr("disabled","disabled");
                            }
                            </script>
					</div>
				</div><!--/span-->
				<!--span -->
                                <div class="box span6">
                                        <div class="box-header well">
                                                <h2><i class="icon-eye-open"></i> 添加子菜单</h2>
                                                <div class="box-icon">
                                                        <a href="#" class="btn btn-setting btn-round"><i class="icon-cog"></i></a>
                                                        <a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
                                                        <a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
                                                </div>
                                        </div>
                                        <div class="box-content">
                                            <form method="post" action="{$webpaths}?c=menuedit">
                                                <input name="currentmenu" type="hidden" value="{$currentmenuval}" />
                                            <p>名称:</p>
                                            <p><input type="text" name="menuname" value="" /></p>
                                            <p>类型:</p>
                                            <p><label lcass="radio"><input type="radio" name="type" value="channel" checked="checked" onclick="disabledselect()" /> 文章分类目录</label></p>
                                            <p><label lcass="radio"><input type="radio" name="type" value="content" onclick="enabledselect()" /> 单页面</label> <select name="myselect1"  disabled="disabled">{section name=i loop=$contentdata}<option value="{$contentdata[i].id}">{$contentdata[i].title}</option>{/section}</select></p>
                                            <p><input type="submit" class="btn btn-info" name="clickadd" value="添加到 {$currentmenuname}" /></p>
                                            </form>
                                        </div>
                                </div><!--/span-->	
			</div>
                            <!-- #################################################### -->
					</div>
                                        <!--内容-->
				</div><!--/span-->
				
			</div><!--/row-->
                        
    </div>

    </div>
    <hr />
    
    <script type="text/javascript">
        $("#myul1").dragsort({
                dragSelector: "div", 
                dragBetween: true, 
                dragEnd: saveOrder, 
                placeHolderTemplate: "<li class='placeHolder'><div></div></li>",
                scrollSpeed: 3
        });

        function saveOrder() {
                var data = $("#myul1 li").map(function(){
                        return $(this).children().html();
                }).get();
                $("input[name=list1SortOrder]").val(data.join("|"));
        };
    </script>
    
{include file="include/footer2.html"}
</div>
{include file="include/footer1.html"}